package com.mp.mqtt.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Service;

/**
 * @Auther adidasshe@mp.cn
 * 监听接口方式，启动服务，执行方式时仍然提供服务，服务初始化之后，执行方法
 */
@Service
public class StartPingService implements CommandLineRunner {

    @Autowired
    private DataToDbService dataToDbService;

    @Override
    public void run(String... args) throws Exception {
        //启动异步线程
        dataToDbService.getData();
    }
}
